package model

type SysRole struct {
	DcModel
	RoleCode string       `json:"role_code" gorm:"comment:角色编码;not null;uniqueIndex;"`
	RoleName string       `json:"role_name" gorm:"comment:角色名称;not null;index;"`
	Org      []SysOrg     `json:"org" gorm:"many2many:sys_org_role;foreignKey:RoleCode;joinForeignKey:RoleCode;references:OrgCode;joinReferences:OrgCode;"`
	Menu     []SysMenu    `json:"menu" gorm:"many2many:sys_role_menu;foreignKey:RoleCode;joinForeignKey:RoleCode;references:MenuCode;joinReferences:MenuCode;"`
	OrgRole  []SysOrgRole `json:"org_role" gorm:"foreignKey:RoleCode;references:RoleCode"` // role has many org_role
}

type RequestGetRoleList struct {
	RequestPageAndSort
	RoleCode string `json:"role_code"`
	RoleName string `json:"role_name"`
}

type RequestAddRole struct {
	RequestAdd
	RoleCode string `json:"role_code"`
	RoleName string `json:"role_name"`
}

type RequestRoleCode struct {
	RoleCode string `json:"role_code"`
}

type RequestRoleMenuEdit struct {
	RoleCode string   `json:"role_code"`
	MenuCode []string `json:"menu_code"`
}
